<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib uri="/WEB-INF/tld/importTag.tld" prefix="importTag"%>
<%@taglib uri="http://java.sun.com/jstl/core_rt" prefix="c-rt"%>
<%@page import="com.yaodian100.core.common.utils.ServerValue"%>
<%@page import="org.apache.commons.lang.math.RandomUtils"%>
<%@page import="java.net.URLEncoder"%><c-rt:set var="frontContentHtmlPath" value='<%=ServerValue.getFrontContentHtmlPath()%>'/>
<script type="text/javascript" charset="UTF-8" src="/js/jquery.flash.js"></script>
<script type="text/javascript" charset="UTF-8" src="/js/jquery.random.js"></script>
<!-- javascript start -->
<script type="text/javascript">
	var gold_top = "";
	var gold_bottom = "";
	var intervalId = "";
	$().ready(function(){
		//default 品牌旗舰
		$("#menu > ul > li").eq(11).attr("class","tab11-f");

		//sidebar
		$("div.sidebar").load("/pages/IDX/SIDEBAR.html",sidrbarIndex);
		var sidebarNum = $.random(2);
		$("div.sidebar > ul > li").eq(sidebarNum).attr("class",$("div.sidebar > ul > li").eq(sidebarNum).attr("class")+"-f");
		$("div.sidebar > div").eq(sidebarNum).show();		
				
		//商品类别
		$("div.pdcalist").load("/pages/IDX/CATEGORY.html");
				
		//品牌
		$("#brandarea").load("/pages/BRAND/IDX.html");
		
		//random show maingold
		var maingoldNum = $.random(5);
		$("div.tab-area.main-gold > ul.tab-list > li").eq(maingoldNum).attr("class",$("div.tab-area.main-gold > ul.tab-list > li").eq(maingoldNum).attr("class")+"-f");
		$("#main-gold-" + (maingoldNum + 1)).show();
		init5Tabs();
		//每六秒自動跳tab,当滑鼠移到上面时则不执行
		$("div.tab-area.main-gold > ul.tab-list > li").each(function(){
			$(this).mouseenter(function(){
				gold_top = $(this);
				clearInterval(intervalId);
			});
			$(this).mouseleave(function(){
				gold_top = "";
				intervalId = setInterval(showRotatingTab,6000);
			});
		});
		$("div[id*='main-gold-']").each(function(){
			$(this).mouseenter(function(){
				gold_bottom = $(this);
				clearInterval(intervalId);
			});
			$(this).mouseleave(function(){
				gold_bottom = "";
				intervalId = setInterval(showRotatingTab,6000);
			});
		});
		//random show top
		var midNum = $.random(4);
		$("div.mid-box.box-event > div.filterbar > a").eq(midNum).attr("class","filter-fc");
		$("#event-sale-bar-" + (midNum + 1)).show();	

		//random show mid
		var topNum = $.random(4);
		$("div.mid-box.box-pobulic > div.filterbar > a").eq(topNum).attr("class","filter-fc");
		$("#pobulic-sale-bar-" + (topNum + 1)).show();		

		//ramdom show btm
		var btmNum = $.random(4);
		$("div.mid-box.box-commend > div.filterbar > a").eq(btmNum).attr("class","filter-fc");
		$("#commend-sale-bar-" + (btmNum + 1)).show();

		//default tab3
		var tab3Num = $.random(3);
		$("div#tab3 > ul.tab-right > li").eq(tab3Num).attr("class",$("div#tab3 > ul.tab-right > li").eq(tab3Num).attr("class")+"f");
		$("div#tab3 > div").eq(tab3Num).show();

		//goldfour(ZIndex待解決)
		var goldfourNum = $.random(3);
		$("div.gold-four > ul.tab-right > li").eq(goldfourNum).attr("class",$("div.gold-four > ul.tab-right > li").eq(goldfourNum).attr("class")+"f");
		$("div.gold-four > div.gold-four-show").eq(goldfourNum).show();

		//goldbn
		var goldbnNum = $.random(3);
		$("div.gold-bn > ul > li").eq(goldbnNum).attr("class",$("div.gold-bn > ul > li").eq(goldbnNum).attr("class")+"f");
		$("div.gold-bn > div").eq(goldbnNum).show();

		//活动快讯、强力放送
		$("div.rightbox.infoarea > div").show();
		$("div.rightbox.broadcast > div").show();
	});
	function mainGoldRotating(){
		//共有幾個tab
		var myImg = new Array("1","2","3","4","5");
		//要取幾張來播放
		var playImg = new Array(5);
		//目前播放到第幾張
		var nowIndex;
		$("div.tab-area.main-gold > ul.tab-list > li").each(function(index,item){
			if ( $(this).attr("class").indexOf("-f") > -1 ){
				nowIndex = index;
			}
		});
		//從allImg中取出N張放到myImg裡面
		for(var i = 0;i < playImg.length;i++){
			playImg[i] = myImg[nowIndex];
			nowIndex++;
			if (nowIndex > 4) nowIndex = 0;
		}
	}
	function showRotatingTab(){
		//共有幾個tab
		var myImg = new Array("0","1","2","3","4");
		//要取幾張來播放
		var playImg = new Array(5);
		//目前播放到第幾張
		var nowIndex = 0;
		var tempNowIndex = 0;
		$("div.tab-area.main-gold > ul.tab-list > li").each(function(index,item){
			var thisClass = $(this).attr("class");
			if ( thisClass.indexOf("-f") > -1 ){
				nowIndex = index;
				$(this).attr("class",thisClass.split("-")[0] + "-" + thisClass.split("-")[1]);
			}
		});
		tempNowIndex = nowIndex;
		$("div[id*='main-gold-']").each(function(){
			$(this).hide();
		});
		tempNowIndex++;
		if (tempNowIndex > 4) tempNowIndex = 0;
		//eq從0開始算
		$("div.tab-area.main-gold > ul.tab-list > li").eq(myImg[tempNowIndex]).attr("class",$("div.tab-area.main-gold > ul.tab-list > li").eq(myImg[tempNowIndex]).attr("class")+"-f");
		$("#main-gold-" + (parseInt(myImg[tempNowIndex],10)+1)).show();
	}	
	function init5Tabs(){
		if ( gold_bottom == "" && gold_top == "" )
			intervalId = setInterval(showRotatingTab,6000);
	}
</script>
<!-- javascript end -->
<!-- sidebar start -->
<div class="sidebar"></div>
<!-- sidebar end -->
<div class="ad-leader">
	<script type="text/javascript">
		GA_googleFillSlot("yd100_00_upper_image_01");
	</script>
</div>
<!-- tab area block adv start -->
<c-rt:set var="mainGoldNum"><%=RandomUtils.nextInt(3)+1%></c-rt:set>
<c-rt:set var="mainGold"><importTag:static path="${frontContentHtmlPath}IDX/MAINGOLD_${mainGoldNum}.html"/></c-rt:set>
<c-rt:choose>
	<c-rt:when test="${not empty mainGold}">${mainGold}</c-rt:when>
	<c-rt:otherwise>
		<importTag:static path="${frontContentHtmlPath}IDX/MAINGOLD_1.html"/>
	</c-rt:otherwise>
</c-rt:choose>
<!-- tab area block adv end -->
<!-- content start -->
<div class="content">	
  <!-- 热销商品  start -->
  <c-rt:set var="hotSaleNum"><%=RandomUtils.nextInt(3)+1%></c-rt:set>
	<c-rt:set var="hotSale"><importTag:static path="${frontContentHtmlPath}IDX/HOTSALE_${hotSaleNum}.html"/></c-rt:set>
	<c-rt:choose>
		<c-rt:when test="${not empty hotSale}">${hotSale}</c-rt:when>
		<c-rt:otherwise>
			<importTag:static path="${frontContentHtmlPath}IDX/HOTSALE_1.html"/>
		</c-rt:otherwise>
	</c-rt:choose>
  <!-- 热销商品  end-->
  <!-- 黄金腰带 start -->
  <div class="barlarge">
		<script type="text/javascript">
	 		GA_googleFillSlot("yd100_00_center_image_01");
		</script>
  </div>
  <!-- 黃金腰帶  end -->
  <!-- 中間  start -->
		<!-- 强檔活动 start -->
		<c-rt:set var="saleTopNum"><%=RandomUtils.nextInt(3)+1%></c-rt:set>
		<c-rt:set var="saleTop"><importTag:static path="${frontContentHtmlPath}IDX/SALE_TOP_${saleTopNum}.html"/></c-rt:set>
		<c-rt:choose>
			<c-rt:when test="${not empty saleTop}">${saleTop}</c-rt:when>
			<c-rt:otherwise><importTag:static path="${frontContentHtmlPath}IDX/SALE_TOP_1.html"/></c-rt:otherwise>
		</c-rt:choose>
		<!-- 强檔活动  end -->
		<!-- 人气最夯 start -->
		<c-rt:set var="saleMidNum"><%=RandomUtils.nextInt(3)+1%></c-rt:set>
		<c-rt:set var="saleMid"><importTag:static path="${frontContentHtmlPath}IDX/SALE_MID_${saleMidNum}.html"/></c-rt:set>
		<c-rt:choose>
			<c-rt:when test="${not empty saleMid}">${saleMid}</c-rt:when>
			<c-rt:otherwise><importTag:static path="${frontContentHtmlPath}IDX/SALE_MID_1.html"/></c-rt:otherwise>
		</c-rt:choose>
		<!-- 人气最夯 end-->
		<!-- 严选推荐 start -->
		<c-rt:set var="saleBtmNum"><%=RandomUtils.nextInt(3)+1%></c-rt:set>
		<c-rt:set var="saleBtm"><importTag:static path="${frontContentHtmlPath}IDX/SALE_BTM_${saleBtmNum}.html"/></c-rt:set>
		<c-rt:choose>
			<c-rt:when test="${not empty saleBtm}">${saleBtm}</c-rt:when>
			<c-rt:otherwise><importTag:static path="${frontContentHtmlPath}IDX/SALE_BTM_1.html"/></c-rt:otherwise>
		</c-rt:choose>
		<!-- 严选推荐 end-->
		<!-- 首頁雙腰帶 -->
    <div class="db-banner">
     	<script type="text/javascript">
		 		GA_googleFillSlot("yd100_00_lower_twins_image_01");
		 		GA_googleFillSlot("yd100_00_lower_twins_image_02");
			</script>
    </div>
		<!-- 商品类别 start -->
		<div class="pdcalist"></div>
		<!-- 商品类别 end -->
</div>
<!-- 中间  end -->
<!-- 右栏  start-->
<div class="right-bar">
	<!-- 个人服务区 start -->
	<div class="my-service">
		<h6><strong>个人服务</strong></h6>
		<a class="my-s1" href="<%=ServerValue.getFrontContextPath()%>/tologin.do?redirect_url=<%=URLEncoder.encode("/member/myOrder/showOrders.do?t=T&p=1","UTF-8")%>" title="订单查询"><img src="/images/none.gif" /></a>
		<a class="my-s2" href="<%=ServerValue.getFrontContextPath()%>/tologin.do?redirect_url=<%=URLEncoder.encode("/member/myCollection/toproductc.do","UTF-8")%>" title="我的收藏"><img src="/images/none.gif" /></a>
		<a class="my-s3" href="<%=ServerValue.getFrontContextPath()%>/tologin.do?redirect_url=<%=URLEncoder.encode("/member/myyaodian.do","UTF-8")%>" title="我的帐户"><img src="/images/none.gif" /></a>
	</div>
	<!-- 个人服务区 end -->
	<!-- 幫助資訊區連結未定 -->
  <div class="help-info">
   	<a class="hpinfo-1" href="<%=ServerValue.getFrontContextPath()%>/toreg.do" title="免费注册"><img src="/images/none.gif" /></a>
    <a class="hpinfo-2" href="<%=ServerValue.getFrontContextPath()%>/tologin.do?redirect_url=<%=URLEncoder.encode("/tologin.do","UTF-8")%>" title="立刻登录"><img src="/images/none.gif" /></a>
    <a class="hpinfo-3" href="/help/5_online.html" title="安心付款"><img src="/images/none.gif" /></a>
    <a class="hpinfo-4" href="/help/1_reg.html" title="新手上路"><img src="/images/none.gif" /></a>
  </div>
  <!-- 幫助資訊區連結未定 -->
  <!-- 三切換廣告  start -->
  <div class="gold-bn">
  	<ul>
    	<li class="gdbn-1"></li>
      <li class="gdbn-2"></li>
      <li class="gdbn-3"></li>
    </ul>
    <div style="display: none;">
	    <script type="text/javascript">
		 		GA_googleFillSlot("yd100_00_select_image_01");
			</script>
		</div>
    <div style="display: none;">
	    <script type="text/javascript">
		 		GA_googleFillSlot("yd100_00_select_image_02");
			</script>
		</div>
    <div style="display: none;">
	    <script type="text/javascript">
		 		GA_googleFillSlot("yd100_00_select_image_03");
			</script>
		</div>
  </div>
  <!-- 三切換廣告  end -->
	<!-- 黄金四格 -->
	<c-rt:set var="goldFourNum"><%=RandomUtils.nextInt(3)+1%></c-rt:set>
	<c-rt:set var="goldFour"><importTag:static path="${frontContentHtmlPath}IDX/GOLDFOUR_${saleTopNum}.html"/></c-rt:set>
	<c-rt:choose>
		<c-rt:when test="${not empty goldFour}">${goldFour}</c-rt:when>
		<c-rt:otherwise><importTag:static path="${frontContentHtmlPath}IDX/GOLDFOUR_1.html"/></c-rt:otherwise>
	</c-rt:choose>
	<!-- 黄金四格 -->
	<!-- 排行榜 start -->
	<importTag:static path="${frontContentHtmlPath}IDX/RANKINGLIST_1.html"/>
	<!-- 排行榜 end -->
	<!-- 品牌旗舰 start -->
	<div id="brandarea"></div>
	<!-- 品牌旗舰  end-->	
	<!-- 活动快讯  start(埋js) -->
	<c-rt:set var="infoNum"><%=RandomUtils.nextInt(3)+1%></c-rt:set>
	<c-rt:set var="info"><importTag:static path="${frontContentHtmlPath}IDX/INFO_${infoNum}.html"/></c-rt:set>
	<c-rt:choose>
		<c-rt:when test="${not empty info}">${info}</c-rt:when>
		<c-rt:otherwise><importTag:static path="${frontContentHtmlPath}IDX/INFO_1.html"/></c-rt:otherwise>
	</c-rt:choose>
	<!-- 活动快讯  end -->
	<!-- 強力放送  start (埋js)-->
	<c-rt:set var="broadCastNum"><%=RandomUtils.nextInt(3)+1%></c-rt:set>
	<c-rt:set var="broadCast"><importTag:static path="${frontContentHtmlPath}IDX/BROADCAST_${broadCastNum}.html"/></c-rt:set>
	<c-rt:choose>
		<c-rt:when test="${not empty broadCast}">${broadCast}</c-rt:when>
		<c-rt:otherwise><importTag:static path="${frontContentHtmlPath}IDX/BROADCAST_1.html"/></c-rt:otherwise>
	</c-rt:choose>
	<!-- 强力放送  end -->
	<!-- 右欄廣告腳 -->
  <div class="rt-bn-end">
  	<script type="text/javascript">
			GA_googleFillSlot("yd100_00_lr_image_01");
		</script>
  </div>
	<!-- 右欄廣告腳 -->
</div>
<!-- 右栏 end -->